package com.guigu.design;

import com.sun.javafx.geom.ShapePair;

/**
 * @description:开闭原则
 * @author: lizhenhua05
 * @created: 2021/01/03 22:39
 */
public class Ocp {

    public static void main(String[] args) {
        Hz hz = new Hz();
        hz.myHz(new Circle());
        hz.myHz(new Zfx());
    }
}


abstract class Shape{
    public abstract void hua();
}

class Circle extends Shape {

    public void hua() {
        System.out.println("绘制圆");
    }
}

class Zfx extends Shape{

    public void hua() {
        System.out.println("绘制正方形");
    }
}

class Hz {
    public void myHz(Shape shape){
        System.out.println("开始绘制");
        shape.hua();
    };
}
